import type { Metadata } from "next";
import "./globals.css";
import { Inter } from "next/font/google";
import React from "react";
import { NuqsAdapter } from "nuqs/adapters/next/app";
import { ApiProvider } from '@/providers/ApiProvider';
import { AuthProvider } from '@/providers/AuthProvider';
import { AuthGuard } from '@/components/auth/AuthGuard';

const inter = Inter({
  subsets: ["latin"],
  preload: true,
  display: "swap",
});

export const metadata: Metadata = {
  title: "Agent Chat",
  description: "Agent Chat UX by LangChain",
  icons: {
    icon: "/personal_logo.svg",
    shortcut: "/personal_logo.svg",
    apple: "/personal_logo.svg",
  },
};

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <AuthProvider>
          <AuthGuard>
            <ApiProvider>
              <NuqsAdapter>{children}</NuqsAdapter>
            </ApiProvider>
          </AuthGuard>
        </AuthProvider>
      </body>
    </html>
  );
}
